#! /usr/bin/env python
# -*- coding: utf-8 -*-

# *************************************************************
#     Filename @  geturls.py
#       Author @  Huoty
#  Create date @  2015-09-30 13:57:56
#  Description @  
# *************************************************************

import sys
import re
import urllib2

# Script starts from here

page = urllib2.urlopen("http://kuanghy.github.io/kswd/")
html = page.read()
reg = r'<div class="item".*?src="(.*?)".*?href="(.*?)".*?>(.*?)</a>'
pattern = re.compile(reg, re.S)
items = re.findall(pattern, html)

for item in items:
    print '{ "name":"%s", "url":"%s", "icon":"%s", "title":"%s" }' % (item[2], item[1], item[0], item[2])
